/* @(#)GSUnBalanceDetailExcelAction.java
 * 
 *  Project:GS
 *  
 *  Modify  Information:
 *  ===============================================
 *   Author          Date            Description
 *  -------------- ---------------  ---------------
 *  Jenny  Li      2006-5-15          新增
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 *
 */
package com.hitrust.gs.action;

import java.util.ArrayList;
import java.util.HashMap;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.form.GSUnBalanceDetlQryForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

/**
 * @author Administrator
 *
 */
public class GSUnBalanceDetailExcelAction extends GSBaseAction {


    public String execute(GSBaseForm aForm) throws Exception {
        try{
            GSUnBalanceDetlQryForm tForm = (GSUnBalanceDetlQryForm)aForm;
            aForm.getRequest().setAttribute("deptId",tForm.deptId);
            aForm.getRequest().setAttribute("balanceYM",tForm.balanceYM);
            aForm.getRequest().setAttribute("deptCategory",tForm.getDeptCategory());
            //取得当前操作员可查询的订货单位和送货地址
            GSOperatorBean tOperBean = (GSOperatorBean)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
            GSOrderDeptInfoProcessor tOrderDeptProc = new GSOrderDeptInfoProcessor();
            HashMap tMap = tOrderDeptProc.getOrderDeptInfoOfBusOper(tOperBean.getGs_oper_org_id());
            aForm.getRequest().setAttribute("orderdept",tMap);
            ArrayList tOrgList = (ArrayList)tMap.get("organization");
            
            GSOrderProcessor tOrderProc = new GSOrderProcessor();
            tOrderProc.exportUnbalancedDetail(tForm,tOrgList);
        }catch(Exception e){
            e.printStackTrace();
            aForm.getRequest().setAttribute("window","true");
            throw e;
        }
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
